@extends('admin.layout.common')
@section('content')
    <link rel="stylesheet" href="//maxcdn.bootstrapcdn.com/bootstrap/3.3.5/css/bootstrap.min.css">
    <link rel="stylesheet" type="text/css" href="{{URL::asset('css/user/StaffManagement.css')}}">
    <div class="content">
        <h1 class="h1">员工管理</h1>
        <table border="1" width="100%">
            <thead>
            <tr>
                <th>ID</th>
                <th>姓名</th>
                <th>部门</th>
                <th>职务</th>
                <th>联系电话</th>
                <th>邮箱</th>
                <th>入职时间</th>
                <th>操作</th>
            </tr>
            </thead>
            @foreach($list as $v)
            <tr id="datatable-responsive" class="id">
                <td>{{$v->id}}</td>
                <td>{{$v->name}}</td>
                <td>{{$v->department_name}}</td>
                <td>{{$v->work}}</td>
                <td>{{$v->phone}}</td>
                <td>{{$v->email}}</td>
                <td>{{$v->create_time}}</td>
                <td>
                    <input type="button" name="" value="编辑" onclick="javascript:window.location.href='{{URL('admin/editManager/'.$v->id)}}'">
                    @if($v->status==1)
                        <input type="button" name="" value="离职" onclick="exit({{$v->id}})">
                    @else
                        <input type="button" name="" value="已离职" style="background-color:#CF2121;border:none;color:#fff;">
                    @endif
                </td>
            </tr>
            @endforeach
        </table>
        {{ $list->links()}}
    </div>
    <script>
        function exit($id) {
            layer.open({
                type: 2,
                area: ['500px', '300px'],
                content: 'http://{{$_SERVER['HTTP_HOST']}}/admin/changeManagerStatus/0'
                , btn: ['确定', '取消']
                , yes: function (index, layero) {
                    $.get('http://{{$_SERVER['HTTP_HOST']}}/admin/changeManagerStatus/' + $id, function (data) {
                        location.reload();
                    })
                }
            })
        }
    </script>
@endsection

